# Maintainer: yumetodo <yume-wikijp@live.jp>

_realname=hexyl
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.13.1
pkgrel=1
pkgdesc="A command-line hex viewer"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64' 'clang32')
url="https://github.com/sharkdp/hexyl"
license=('spdx:Apache-2.0' 'spdx:MIT')
depends=()
makedepends=("${MINGW_PACKAGE_PREFIX}-rust")
source=(
  "${url}/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz"
)
sha512sums=('cffa229dafe9b9b87aaa4aa54bb3cc33689a4cee17a4364f2ba393e424ee82a9f1ceaa3cc11b47d595dfbe41b8fba7f51faf53c8c883387709f977e6e10411c8')
b2sums=('466252eb24179fd330136d4b257ede9aac9f7e74d7e228656f2d2c5d3c6630bafe925155b0494a42869b0ebb8b73c3fb743e9d10d3b2ad04a59501a8b94784e2')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  cargo build --release --locked
}

check() {
  cd "${srcdir}/${_realname}-${pkgver}"
  cargo test --release --locked
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  install -Dm 755 "target/release/${_realname}" "${pkgdir}${MINGW_PREFIX}/bin/${_realname}"
  install -Dm 644 LICENSE* -t "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}"
}
